package top.buyibuyi.course.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buyibuyi.course.R;
import top.buyibuyi.course.feign.LoginClient;
import top.buyibuyi.course.pojo.Admin;

@RestController
@CrossOrigin
@RequestMapping("/teacher")
public class LoginController {

    @Autowired
    private LoginClient loginClient;

    @PostMapping("/login")
    public R login(@RequestBody Admin admin){
        R r = loginClient.loginAdmin(admin);

        System.out.println(r.getData().get("data"));
        return r;
    }

    @GetMapping("/info")
    public R getInfo(){
        return loginClient.info();
    }
}
